﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace T.FAS.Runtime.DataAccess.SQLDom
{
    /// <summary>
    /// 查询投影字段
    /// </summary>
    public class QueryProjectionField
    {
        /// <summary>
        /// 内容
        /// </summary>
        public string Field { get; set; }

        /// <summary>
        /// 查询投影字段类型
        /// </summary>
        public FieldType FieldType { get; set; }

        private QueryProjectionField()
        {

        }

        public static QueryProjectionField BuildWithColumn(string column)
        {
            var field = new QueryProjectionField
            {
                Field = column,
                FieldType = FieldType.Column
            };
           
            return field;
        }        

        public static QueryProjectionField BuildWithExpression(string expression)
        {
            var field = new QueryProjectionField
            {
                Field = expression,
                FieldType = FieldType.FunctionExpression
            };

            return field;
        }

        public static QueryProjectionField BuildWithElement(string elementCode)
        {
            var field = new QueryProjectionField
            {
                Field = elementCode,
                FieldType = FieldType.Element
            };

            return field;
        }
    }
}
